package com.sltx.service.impl;


import com.sltx.dao.aaa.YzqyMapper;
import com.sltx.service.YzqyService;
import com.sltx.util.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class YzqyServiceImpl implements YzqyService {
    @Autowired
    private YzqyMapper yzqyMapper;

    @Override
    public List<Map<String, Object>> getYzqyList(PageData pd) {
        return yzqyMapper.getYzqyList(pd);
    }

    //获取条数
    @Override
    public int getNum(PageData pd) {
        return yzqyMapper.getNum(pd);
    }


    @Override
    public int getCxqyByNameNum(PageData pd) {
        return yzqyMapper.getCxqyByNameNum(pd);
    }

    @Override
    public List<Object> getCxqyByName(PageData pd) {
        List<Object> result = new ArrayList<>();
        List<Map<String,Object>> list = yzqyMapper.getCxqyByName(pd);
        for (Map m : list){

            if("季度".equals(pd.get("update_quarterly"))){
                m.put("update_year",m.get("update_quarterly"));
            }
            result.add(m);
        }
        return result;
}

    //获取最大季度
    @Override
    public String bigQuarter() {
        return yzqyMapper.bigQuarter();
    }

    ////获取查询的年份和季度
    @Override
    public Map<String, Object> getYearandquarterlt(PageData pd) {
       return yzqyMapper.getYearandquarterlt(pd);
    }
}
